package com.tanhua.db.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tanhua.api.QuestionApi;
import com.tanhua.db.mapper.QuestionMapper;
import com.tanhua.model.pojo.Question;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;


@DubboService
public class QuestionApiImpl implements QuestionApi {
   @Autowired
    QuestionMapper questionMapper;
    public Question findById(Long id){
        Question question = questionMapper.selectOne(Wrappers.<Question> lambdaQuery().eq(Question::getUserId,id));
        return question;
    }

    @Override
    public void save(Question question1) {
        questionMapper.insert(question1);
    }

    @Override
    public void update(Question question1) {
questionMapper.updateById(question1);
    }
}
